package com.qdxwx.models.course;

import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

public class CourseQuery implements Serializable {

    private static final long serialVersionUID = 2842827458481944473L;

    private Integer courseId;
    private Integer channelId;
    private Integer categoryId;
    private String courseName;
    private Integer isAvailable;
    private Integer teacherId;
    private Integer subjectId;
    /**
     * 0=course_id desc
     * 1=view_count desc
     * 2=buy_count desc
     * 3=price asc
     * 4=price desc
     * 5=update_time desc
     */
    private Integer orderBy;

    private String sellType;//课程类型：COURSE(课程) LIVE(直播) PACKAGE(套餐)
    private String sellTypeExclude;//排除的课程类型：COURSE(课程) LIVE(直播) PACKAGE(套餐)

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime beginCreateTime;//查询 开始添加时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endCreateTime;//查询 结束添加时间
    private Long userId;//用户id

    private Integer memberTypeId;//会员类型id

    private Integer isFree;//查询免费课程
    private Integer isOverdue;//是否过期
    private Integer isLiving;//<!-- 查询正则直播的-->
    private Integer isTop;
    private Integer isElite;
    public CourseQuery() { }

    public Integer getIsTop() {
        return isTop;
    }

    public void setIsTop(Integer isTop) {
        this.isTop = isTop;
    }

    public Integer getIsElite() {
        return isElite;
    }

    public void setIsElite(Integer isElite) {
        this.isElite = isElite;
    }

    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }

    public Integer getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(Integer subjectId) {
        this.subjectId = subjectId;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public Integer getIsAvailable() {
        return isAvailable;
    }

    public void setIsAvailable(Integer isAvailable) {
        this.isAvailable = isAvailable;
    }

    public Integer getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Integer teacherId) {
        this.teacherId = teacherId;
    }

    public Integer getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(Integer orderBy) {
        this.orderBy = orderBy;
    }

    public Integer getIsFree() {
        return isFree;
    }

    public void setIsFree(Integer free) {
         this.isFree = free;
    }

    public String getSellType() {
        return sellType;
    }

    public void setSellType(String sellType) {
        if (sellType == null) return;
        if (sellType.contains("PACKAGE")) {
            this.sellType = "PACKAGE";// (套餐)
        } else if (sellType.contains("LIVE")) {
            this.sellType = "LIVE";//(直播)
        } else {
            this.sellType = "COURSE";//(课程)
        }
    }

    public String getSellTypeExclude() {
        return sellTypeExclude;
    }

    public void setSellTypeExclude(String sellTypeExclude) {
        if (sellTypeExclude == null) return;
        if (sellTypeExclude.contains("PACKAGE")) {
            this.sellTypeExclude = "PACKAGE";// (套餐)
        } else if (sellTypeExclude.contains("LIVE")) {
            this.sellTypeExclude = "LIVE";//(直播)
        } else {
            this.sellTypeExclude = "COURSE";//(课程)
        }
    }

    public LocalDateTime getBeginCreateTime() {
        return beginCreateTime;
    }

    public void setBeginCreateTime(LocalDateTime beginCreateTime) {
        this.beginCreateTime = beginCreateTime;
    }

    public LocalDateTime getEndCreateTime() {
        return endCreateTime;
    }

    public void setEndCreateTime(LocalDateTime endCreateTime) {
        this.endCreateTime = endCreateTime;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getIsOverdue() {
        return isOverdue;
    }

    public void setIsOverdue(Integer overdue) {
        isOverdue = overdue;
    }

    public Integer getMemberTypeId() {
        return memberTypeId;
    }

    public void setMemberTypeId(Integer memberTypeId) {
        this.memberTypeId = memberTypeId;
    }

    public Integer getIsLiving() {
        return isLiving;
    }

    public void setIsLiving(Integer living) {
        isLiving = living;
    }

    @Override
    public String toString() {
        return "CourseQuery{" +
                "courseId=" + courseId +
                ", channelId=" + channelId +
                ", categoryId=" + categoryId +
                ", courseName='" + courseName + '\'' +
                ", isAvailable=" + isAvailable +
                ", teacherId=" + teacherId +
                ", order='" + orderBy + '\'' +
                ", isFree='" + isFree + '\'' +
                ", sellType='" + sellType + '\'' +
                ", sellTypeExclude='" + sellTypeExclude + '\'' +
                ", beginCreateTime=" + beginCreateTime +
                ", endCreateTime=" + endCreateTime +
                ", userId=" + userId +
                ", isOverdue='" + isOverdue + '\'' +
                ", memberTypeId=" + memberTypeId +
                ", isLiving='" + isLiving + '\'' +
                ", isTop=" + isTop +
                ", isElite=" + isElite +
                '}';
    }
}
